package com.softaria.spkiller.dependencies;


import classycle.Analyser;
import classycle.graph.AtomicVertex;
import classycle.util.StringPattern;
import classycle.util.TrueStringPattern;


public class ClassycleDependencyFinder implements DependencyFinder {

	@Override
	public DependencyGraph findDependencies(String[] pathToFolderOrJar,
			final ClassFilter inclusionFilter, boolean mergeInternalClasses) {

		StringPattern p = new StringPattern() {
			@Override
			public boolean matches(String string) {
				return inclusionFilter==null?true:inclusionFilter.accept(string);
			}
		};

		Analyser a = new Analyser( pathToFolderOrJar , p,
				new TrueStringPattern(), mergeInternalClasses);

		AtomicVertex vertexes[] = a.getClassGraph();
		
		return new ClassycleDependencyGraph(vertexes); 

	}

}
